
#pragma once

#include <ttg/services.h>
#include "Common/ICalculationCore.h"

//Version that performs serial simulation.
class serialCore :public ICalculationCore
{
	public:
		virtual double simulate(InterleavedBodies::SubVector bodies, float dt)
		{
			double t_start = ttg::services::Timer::getRef()->getSeconds();
			for (size_t i = 0; i < bodies.getSize(); i++)
			{
				for (size_t j = i + 1; j < bodies.getSize(); j++)
					bodies.interactWithEachOther(i, j);
				bodies.update(i, dt);
			}
			double t_end = ttg::services::Timer::getRef()->getSeconds();
			return t_end - t_start;
		}
};
